﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EyFramework.Common;
using HzybService.BaseInData;
using HzybService.BaseOutData;
using YbService.Core.Core.Service;
using YbService.Entity.Dto;
using YbService.Entity.Hzyb.BaseInData;
using YbService.Entity.Hzyb.BaseOutData;

namespace HzybService
{
    public class HZSiInterface
    {
        /// <summary>
        /// 获取人员基本信息2100
        /// </summary>
        /// <param name="huoQuRyjbxx"></param>
        /// <returns></returns>
        public static HzybAccount HuoQuRyjbxx2100(RcHuoQuRyjbxx huoQuRyjbxx)
        {
            HzybReturn result = CallHzyb(huoQuRyjbxx);
            return new HzybAccount(result);
        }

        /// <summary>
        /// 调用医保的2210交易，建立就诊档案
        /// </summary>
        /// <param name="jianLiJzda"></param>
        /// <returns></returns>
        public static JianLiJzda JianLiJzda2210(RcJianLiJzda jianLiJzda)
        {
            HzybReturn result = CallHzyb(jianLiJzda);
            return new JianLiJzda(result);
        }

        public static HzybReturn CallHzyb(HzybRc hzybRc)
        {
            if (!hzybRc.CheckData())
            {
                throw new BizException(hzybRc._ErrText);
            }
            HzybBusinessParam hzybBusiness = new HzybBusinessParam()
            {
                JiaoYiLx = hzybRc.JiaoYiLx,
                JiaoYiLxmc = hzybRc.JiaoYiLxmc,
                MzzyLsh = hzybRc.MzzyLsh,
                KaLeiXing = hzybRc.KaLeiXing,
                ShuRuCanshu = hzybRc.GetInputStr(),
                YeWuZqh = hzybRc.YeWuZqh,
                YewuJylsh = hzybRc.YiYuanJylsh
            };
            return BaseHzyb.HzybBusinessHandle(hzybBusiness);
        }

        public static ChuFangMxsc ChuFangMxsc2310(RcChuFangMxsc chuFangMxsc)
        {
            HzybReturn result = CallHzyb(chuFangMxsc);
            return new ChuFangMxsc(result);
        }

        /// <summary>
        /// 费用结算_预结算
        /// </summary>
        /// <param name="feiYong"></param>
        /// <returns></returns>
        public static FeiYongJs FeiYongYjs2420(RcFeiYong feiYong)
        {
            HzybReturn result = CallHzyb(feiYong);
            return new FeiYongJs(result);
        }

        /// <summary>
        /// 费用结算_预结算
        /// </summary>
        /// <param name="feiYong"></param>
        /// <returns></returns>
        public static FeiYongJs FeiYongJs2410(RcFeiYong feiYong)
        {
            HzybReturn result = CallHzyb(feiYong);
            var feiyongJs = new FeiYongJs(result);
            //门诊结算成功，保存结算记录
            DataSaveService.SaveDzpzJsjl(feiYong, feiyongJs);
            return feiyongJs;
        }
    }
}